﻿<?php
include_once('../../includes/metodos.php');
include_once('action.php');

checkUser();
include_once('../cabecalho.php');

if(!empty($_POST['cmd']) && $_POST['cmd']=='insert'){
	insert();
}
$query = mysql_query("SELECT * FROM econ_usuarios WHERE id=".$_SESSION['id']);
$row = mysql_fetch_array($query);
$permissao = $row['permissao'];
?>
<div id="conteudo_col_new">
   <br>
   <div id="div_sup_col_new">	
		<form action="new.php" method="post">
		<label id="label_col_new">Titulo:</label>
		<input id="iput_col_new" type="text" name="titulo"/>
		<label id="label_col_new">Assuntos Relacionados:</label>
		<input id="iput_col_new" type="text" name="tags"/><br>
		<?php 
			if($permissao==1){
				echo '<label>Colunista </label>';
				echo '<select name="colunista">';
				$query = mysql_query("SELECT * FROM econ_usuarios WHERE status=1 AND (permissao=2 OR id=71) ORDER BY nome ASC");
				while ($row = mysql_fetch_array($query)) {
					echo '<option value="'.$row['id'].'">'.$row['nome'].'</option>';
				}
				echo '</select>';
			}
		?>
	 <div id="div_status_col_new"> 		
		<label id="label_col_new">Status</label><br>
		<input type="radio" name="status" value="1"/><label id="label_col_new_ativo">Ativo</label><br/>
		<input type="radio" name="status" value="2" checked="checked"><label id="label_col_new">Inativo</label><br/>
	 </div>
	 <br><br><br><br>
   </div>
   <div id="div_textarea_col_new">		
		<textarea rows="" cols="" name="conteudo"></textarea><br/>
		<input type="hidden" name="cmd" value="insert">
		<input ID="nova_noticia"  type="submit" value="Salvar"/>
	    </form>
   </div>
</div>